package com.kitchen.api.controller;

import com.kitchen.common.vo.ResultVO;
import com.kitchen.service.MenuService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 78468
 * 菜谱接口
 */
@RequestMapping("/menu")
@RestController
@Api(tags = "菜谱管理")
@CrossOrigin
public class MenuController {

    @Autowired
    private MenuService menuService;

    @ApiOperation("搜索菜谱&食材")
    @RequestMapping(value = "/search",method = RequestMethod.GET)
    @ApiImplicitParams({
            @ApiImplicitParam(dataType = "String",required = true,name = "fName" , value = "想要搜索的菜品名称或食材名称")
    })
    public ResultVO search(String fName){
        return menuService.showRecipe(fName);
    }
}
